package com.thermofisher.dsc.amanda.security.jwt;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

public class JWTInfo implements Serializable, IJWTInfo {

    private String username;
    private String id;
    private List<String> permissions;

    public JWTInfo(String username, String id, List<String> permissions) {
        this.username = username;
        this.id = id;
        this.permissions = permissions;
    }

    public JWTInfo() {
    }

    @Override
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }


    @Override
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public List<String> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<String> permissions) {
        this.permissions = permissions;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {return true;}
        if (o == null || getClass() != o.getClass()) {return false;}
        JWTInfo jwtInfo = (JWTInfo) o;
        return Objects.equals(username, jwtInfo.username) &&
            Objects.equals(id, jwtInfo.id) &&
            Objects.equals(permissions, jwtInfo.permissions);
    }

    @Override
    public int hashCode() {
        return Objects.hash(username, id, permissions);
    }
}
